#ifndef MAINWINDOW_H
#define MAINWINDOW_H

#include <QMainWindow>
#include <QTimer>
#include <QPalette>
#include <QScreen>

QT_BEGIN_NAMESPACE
namespace Ui { class MainWindow; }
QT_END_NAMESPACE

class MainWindow : public QMainWindow
{
    Q_OBJECT

public:
    MainWindow(QWidget *parent = nullptr);
    ~MainWindow();

private:
    Ui::MainWindow *ui;

public slots:
    void nextColor(){
        static const QStringList colors = {"red", "green", "blue"};
        static int currentIndex = 0;

        //Count next color index && Loop
        currentIndex = (currentIndex + 1) % colors.size();

        //Renew color
        changeColor(colors.at(currentIndex));
    }

public:
    void changeColor(const QString &colorName){
        setStyleSheet(QString("background-color: %1;").arg(colorName));
        update();
    }
};
#endif // MAINWINDOW_H
